#!/usr/bin/env bash

set -e -u -x
source ./tasks/helpers.sh

cue_version="0.9.2"
cue_hash="67c88f6c3bdf884301794c3ec91f9e6e3f660e7de3b7e10cd29fbbd291baac50"
if [ "$TARGETARCH" == "arm64" ]; then
  cue_hash="3b90c49faaf3367338bd95db0bf76ec86bf4ca7d175d42a221e27bdc8d265256"
fi

task_working_dir
download "https://github.com/cue-lang/cue/releases/download/v${cue_version}/cue_v${cue_version}_linux_${TARGETARCH}.tar.gz" "sha256" "$cue_hash"
extract_download "cue_v${cue_version}_linux_${TARGETARCH}.tar.gz"

install -D -m 755 "cue" "$STAGE_EMBEDDED_DIR/bin/cue"

stamp
